using Godot;
using System;

public partial class Input4 : Node
{
	[Export]
	public PackedScene scene;
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
		if (Input.IsActionJustPressed("左"))
		{
			// 获取当前场景数
			SceneTree tree = this.GetTree();
			// 切换场景
			// tree.ChangeSceneToFile("res://04.场景切换/4game2.tscn");
			tree.ChangeSceneToPacked(scene);

		}
		if (Input.IsActionJustPressed("右"))
		{
			// 实例化新场景，并返回了一个根节点
			Node node = scene.Instantiate();
			// 添加进来
			this.GetTree().CurrentScene.AddChild(node);

		}
	}
}
